package day07_14.day11;

import java.util.Scanner;

public class Main02 {
    public static void main(String[] args) {
        Scanner scn = new Scanner(System.in);
        int num = scn.nextInt();
        String str = Integer.toBinaryString(num);
        System.out.println(fun(str));

    }
    public static int fun(String str){
        int max = 0;
        int cur = 0;
        char[] chaStr = str.toCharArray();
        for (int i = 0; i < chaStr.length; i++) {
            if (chaStr[i] == '1'){
                cur++;
            }
            max = Math.max(max , cur);
            if (chaStr[i] == '0'){
                cur = 0;
            }
        }
        return max;
    }

}
